using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ScreenSnapper
{
    public partial class SimpleStringInputDlg : Form
    {
        public static string ShowInputDialog(Form parent, string prompt, string defaultValue)
        {
            SimpleStringInputDlg dlg = new SimpleStringInputDlg(prompt, defaultValue);
            DialogResult result = dlg.ShowDialog(parent);
            if (DialogResult.OK == result)
            {
                return dlg.InputText;
            }
            return null;
        }

        public SimpleStringInputDlg(string prompt, string defaultValue)
        {
            InitializeComponent();
            Text = prompt;
            _textBox.Text = defaultValue;
        }

        private string _inputText;
        public string InputText
        {
            get
            {
                return _inputText;
            }
            set
            {
                _inputText = value;
            }
        }

        private void SimpleStringInputDlg_FormClosing(object sender, FormClosingEventArgs e)
        {
            _inputText = _textBox.Text;
        }


    }
}